library(tidyverse)
library(mice)
library(skimr)
library(corrplot)
library(car)
library(ISLR)
library(ggplot2)
library(gridExtra)
library(SamplingStrata)
library(rbin)
library(leaps)
library(dplyr)
library(ggplot2)
library(geosphere)
library(broom)
library(plyr)
library(devtools)
options(scipen=999)
nycraw <- read.csv("https://raw.githubusercontent.com/JaclynCoate/6372_Project/master/AB_NYC_2019.csv", header = TRUE, strip.white=TRUE)
head(nycraw)
## id name host_id
## 1 2539 Clean & quiet apt home by the park 2787
## 2 2595 Skylit Midtown Castle 2845
## 3 3831 Cozy Entire Floor of Brownstone 4869
## 4 5022 Entire Apt: Spacious Studio/Loft by central park 7192
## 5 5099 Large Cozy 1 BR Apartment In Midtown East 7322
## 6 5121 BlissArtsSpace! 7356
## host_name neighbourhood_group neighbourhood latitude longitude
## 1 John Brooklyn Kensington 40.64749 -73.97237
## 2 Jennifer Manhattan Midtown 40.75362 -73.98377
## 3 LisaRoxanne Brooklyn Clinton Hill 40.68514 -73.95976
## 4 Laura Manhattan East Harlem 40.79851 -73.94399
## 5 Chris Manhattan Murray Hill 40.74767 -73.97500
## 6 Garon Brooklyn Bedford-Stuyvesant 40.68688 -73.95596
## room_type price minimum_nights number_of_reviews last_review
## 1 Private room 149 1 9 10/19/18
## 2 Entire home/apt 225 1 45 5/21/19
## 3 Entire home/apt 89 1 270 7/5/19
## 4 Entire home/apt 80 10 9 11/19/18
## 5 Entire home/apt 200 3 74 6/22/19
## 6 Private room 60 45 49 10/5/17
## reviews_per_month calculated_host_listings_count availability_365
## 1 0.21 6 365
## 2 0.38 2 355
## 3 4.64 1 194
## 4 0.10 1 0
## 5 0.59 1 129
## 6 0.40 1 0
str(nycraw)
## 'data.frame': 34464 obs. of 16 variables:
## $ id : int 2539 2595 3831 5022 5099 5121 5178 5203 5238 5295 ...
## $ name : Factor w/ 34000 levels ""," Private 1 bdrm Lefferts Gr, BK apt",..: 8990 27105 11178 13776 17775 5839 17808 11099 12643 3931 ...
## $ host_id : int 2787 2845 4869 7192 7322 7356 8967 7490 7549 7702 ...
## $ host_name : Factor w/ 9124 levels ""," Valéria",..: 4017 3840 4984 4754 1544 2840 7735 5519 958 4836 ...
## $ neighbourhood_group : Factor w/ 5 levels "Bronx","Brooklyn",..: 2 3 2 3 3 2 3 3 3 3 ...
## $ neighbourhood : Factor w/ 218 levels "Allerton","Arden Heights",..: 108 127 42 62 137 14 95 201 36 201 ...
## $ latitude : num 40.6 40.8 40.7 40.8 40.7 ...
## $ longitude : num -74 -74 -74 -73.9 -74 ...
## $ room_type : Factor w/ 3 levels "Entire home/apt",..: 2 1 1 1 1 2 2 2 1 1 ...
## $ price : int 149 225 89 80 200 60 79 79 150 135 ...
## $ minimum_nights : int 1 1 1 10 3 45 2 2 1 5 ...
## $ number_of_reviews : int 9 45 270 9 74 49 430 118 160 53 ...
## $ last_review : Factor w/ 908 levels "1/1/17","1/1/18",..: 113 575 775 175 671 144 677 745 716 671 ...
## $ reviews_per_month : num 0.21 0.38 4.64 0.1 0.59 0.4 3.47 0.99 1.33 0.43 ...
## $ calculated_host_listings_count: int 6 2 1 1 1 1 1 1 4 1 ...
## $ availability_365 : int 365 355 194 0 129 0 220 0 188 6 ...
nrow(nycraw)
## [1] 34464
#Creating a new, tsquare_distance (distance to Times Square in miles)
for (i in 1:nrow(nycraw)) {
n <- (distHaversine(c(nycraw$latitude[i], -nycraw$longitude[i]), c(40.7580, 73.9855)) / 1609.344)
nycraw$tsquare_distance[i] <- n
}
head(nycraw)
## id name host_id
## 1 2539 Clean & quiet apt home by the park 2787
## 2 2595 Skylit Midtown Castle 2845
## 3 3831 Cozy Entire Floor of Brownstone 4869
## 4 5022 Entire Apt: Spacious Studio/Loft by central park 7192
## 5 5099 Large Cozy 1 BR Apartment In Midtown East 7322
## 6 5121 BlissArtsSpace! 7356
## host_name neighbourhood_group neighbourhood latitude longitude
## 1 John Brooklyn Kensington 40.64749 -73.97237
## 2 Jennifer Manhattan Midtown 40.75362 -73.98377
## 3 LisaRoxanne Brooklyn Clinton Hill 40.68514 -73.95976
## 4 Laura Manhattan East Harlem 40.79851 -73.94399
## 5 Chris Manhattan Murray Hill 40.74767 -73.97500
## 6 Garon Brooklyn Bedford-Stuyvesant 40.68688 -73.95596
## room_type price minimum_nights number_of_reviews last_review
## 1 Private room 149 1 9 10/19/18
## 2 Entire home/apt 225 1 45 5/21/19
## 3 Entire home/apt 89 1 270 7/5/19
## 4 Entire home/apt 80 10 9 11/19/18
## 5 Entire home/apt 200 3 74 6/22/19
## 6 Private room 60 45 49 10/5/17
## reviews_per_month calculated_host_listings_count availability_365
## 1 0.21 6 365
## 2 0.38 2 355
## 3 4.64 1 194
## 4 0.10 1 0
## 5 0.59 1 129
## 6 0.40 1 0
## tsquare_distance
## 1 2.2968748
## 2 0.1459679
## 3 2.2596886
## 4 2.9737754
## 5 0.7525852
## 6 2.4536331
#Dropping logical irrelevant variables: "id", "name", "host_id", "host_name", "last_review", "latitude", "longitude", "neighborhood"
nyc2 <- select(nycraw, -c("id", "name", "host_id", "host_name", "last_review", "latitude", "longitude", "neighbourhood_group"))
head(nyc2)
## neighbourhood room_type price minimum_nights
## 1 Kensington Private room 149 1
## 2 Midtown Entire home/apt 225 1
## 3 Clinton Hill Entire home/apt 89 1
## 4 East Harlem Entire home/apt 80 10
## 5 Murray Hill Entire home/apt 200 3
## 6 Bedford-Stuyvesant Private room 60 45
## number_of_reviews reviews_per_month calculated_host_listings_count
## 1 9 0.21 6
## 2 45 0.38 2
## 3 270 4.64 1
## 4 9 0.10 1
## 5 74 0.59 1
## 6 49 0.40 1
## availability_365 tsquare_distance
## 1 365 2.2968748
## 2 355 0.1459679
## 3 194 2.2596886
## 4 0 2.9737754
## 5 129 0.7525852
## 6 0 2.4536331
nyc2 <- nyc2[!(nyc2$price==0),]
nyc2 <- nyc2[!(nyc2$availability_365==0),]
invisible(view(nyc2))
#Checking for NAs
md.pattern(nyc2)
## /\ /\
## { `---' }
## { O O }
## ==> V <== No need for mice. This data set is completely observed.
## \ \|/ /
## `-----'
## neighbourhood room_type price minimum_nights number_of_reviews
## 25487 1 1 1 1 1
## 0 0 0 0 0
## reviews_per_month calculated_host_listings_count availability_365
## 25487 1 1 1
## 0 0 0
## tsquare_distance
## 25487 1 0
## 0 0
nrow(nyc2)
## [1] 25487
#Drop NAs that are present
nyc3 <- na.omit(nyc2)
#Confirming NA drop
nrow(nyc3)
## [1] 25487
#Storing categorical variables as factors
skim(nyc3)
## Skim summary statistics
## n obs: 25487
## n variables: 9
##
## ── Variable type:factor ──────────────────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n n_unique
## neighbourhood 0 25487 25487 217
## room_type 0 25487 25487 3
## top_counts ordered
## Bed: 2172, Wil: 1739, Har: 1470, Bus: 1195 FALSE
## Ent: 13363, Pri: 11472, Sha: 652, NA: 0 FALSE
##
## ── Variable type:integer ─────────────────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n mean sd p0
## availability_365 0 25487 25487 169.11 123.76 1
## calculated_host_listings_count 0 25487 25487 6.98 32.08 1
## minimum_nights 0 25487 25487 6.23 16.8 1
## number_of_reviews 0 25487 25487 38.94 54.8 1
## price 0 25487 25487 146.99 170.37 10
## p25 p50 p75 p100 hist
## 52 157 290 365 ▇▅▂▃▂▃▃▆
## 1 1 3 327 ▇▁▁▁▁▁▁▁
## 1 2 4 999 ▇▁▁▁▁▁▁▁
## 5 17 51 629 ▇▁▁▁▁▁▁▁
## 69 107 175 8500 ▇▁▁▁▁▁▁▁
##
## ── Variable type:numeric ─────────────────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n mean sd p0 p25 p50 p75
## reviews_per_month 0 25487 25487 1.85 1.81 0.02 0.49 1.29 2.73
## tsquare_distance 0 25487 25487 3.44 3.07 0.016 1.48 2.69 4.26
## p100 hist
## 58.5 ▇▁▁▁▁▁▁▁
## 18.86 ▇▇▂▁▁▁▁▁
corrNYC <- nyc3
#Table numeric variables
corrNYCTable <- corrNYC %>% keep(is.numeric) %>% cor %>% view
#Plot numeric variables v numeric variables
corrNYC %>% keep(is.numeric) %>% cor %>% corrplot("upper", addCoef.col = "white", number.digits = 2, number.cex = 0.5, method="square", order="hclust", tl.srt=45, tl.cex = 0.8)
invisible(view(corrNYCTable))
#Removing reviews_per_month due to high correlation of is and number_of_reviews
nyc4 <- select(nyc3, -c("reviews_per_month"))
summary(nyc4)
## neighbourhood room_type price
## Bedford-Stuyvesant: 2172 Entire home/apt:13363 Min. : 10
## Williamsburg : 1739 Private room :11472 1st Qu.: 69
## Harlem : 1470 Shared room : 652 Median : 107
## Bushwick : 1195 Mean : 147
## Hell's Kitchen : 1171 3rd Qu.: 175
## Upper East Side : 867 Max. :8500
## (Other) :16873
## minimum_nights number_of_reviews calculated_host_listings_count
## Min. : 1.000 Min. : 1.00 Min. : 1.000
## 1st Qu.: 1.000 1st Qu.: 5.00 1st Qu.: 1.000
## Median : 2.000 Median : 17.00 Median : 1.000
## Mean : 6.233 Mean : 38.94 Mean : 6.981
## 3rd Qu.: 4.000 3rd Qu.: 51.00 3rd Qu.: 3.000
## Max. :999.000 Max. :629.00 Max. :327.000
##
## availability_365 tsquare_distance
## Min. : 1.0 Min. : 0.01632
## 1st Qu.: 52.0 1st Qu.: 1.47596
## Median :157.0 Median : 2.69428
## Mean :169.1 Mean : 3.44215
## 3rd Qu.:290.0 3rd Qu.: 4.25571
## Max. :365.0 Max. :18.85560
##
nyc4 <- filter(nyc4, price >= 25 & price <= 400)
nyc4 <- nyc4[!(nyc4$minimum_nights > 365),]
invisible(view(nyc4))
#nyc4 %>% pairs() No color model
pairs(nyc4,col=nyc4$neighbourhood) #Color by neighborhood
log.nyc <- nyc4 %>% mutate(lprice=log(price))
log.nyc <- select(log.nyc, -c("price"))
invisible(log.nyc)
pairs(log.nyc,col=log.nyc$neighbourhood)
log.indep.nyc <- log.nyc %>% mutate(lreviews=log(number_of_reviews))
log.indep.nyc <- log.indep.nyc %>% mutate(lnights=log(minimum_nights))
log.indep.nyc <- log.indep.nyc %>% mutate(llistings=log(calculated_host_listings_count))
log.indep.nyc <- log.indep.nyc %>% mutate(lavailablility=log(availability_365))
log.indep.nyc <- log.indep.nyc %>% mutate(ltsqr=log(tsquare_distance))
invisible(log.indep.nyc)
log.indep.nyc <- select(log.indep.nyc, -c("minimum_nights", "number_of_reviews", "calculated_host_listings_count", "availability_365", "tsquare_distance"))
# Checking for -inf logged results
invisible(log.indep.nyc)
# Drop -inf log reults in lavailability
log.indep.nyc<-log.indep.nyc[!(log.indep.nyc$lavailablility=="-Inf"),]
invisible(log.indep.nyc)
pairs(log.indep.nyc,col=log.indep.nyc$neighbourhood) #Color by neighborhood
nyc.bins <- nyc4
nyc.bins$reviewsBin <- var.bin(nyc.bins$number_of_reviews, bins = 50)
nyc.bins$nightsBin <- var.bin(nyc.bins$minimum_nights, bins = 50)
nyc.bins$availBin <- var.bin(nyc.bins$availability_365, bins = 50)
nyc.bins$listBin <- var.bin(nyc.bins$calculated_host_listings_count, bins = 10)
nyc.bins$tsquBin <- var.bin(nyc.bins$tsquare_distance, bins = 20)
nyc.bins <- select(nyc.bins,-c("minimum_nights", "number_of_reviews", "calculated_host_listings_count", "availability_365", "tsquare_distance"))
invisible(nyc.bins)
nyc.bin.model <-lm(price~.,data=nyc.bins)
#nyc.bins %>% pairs() No color model
pairs(nyc.bins,col=nyc.bins$neighbourhood) #Color by neighborhood
plot(nyc4$neighbourhood, nyc4$price, xlab = "Neighbourhood", ylab = "Price", title = "Price v Neighbourhood Correlation Check", col=c(7,32,52,82,107))
nycNeighborhood <- ddply(nyc4,.(neighbourhood), function(x) x[sample(nrow(x),1),])
plot(nycNeighborhood$neighbourhood, nycNeighborhood$price, xlab = "Neighbourhood", ylab = "Price", title = "Price v Neighbourhood Correlation Check")
plot(nyc4$room_type, nyc4$price, xlab = "Room Type", ylab = "Price", title = "Price v Room Type Correlation Check", col=c(7,32,52))
nyc.anova.raw <- read.csv("https://raw.githubusercontent.com/JaclynCoate/6372_Project/master/AB_NYC_2019.csv", header = TRUE, strip.white=TRUE)
head(nyc.anova.raw)
## id name host_id
## 1 2539 Clean & quiet apt home by the park 2787
## 2 2595 Skylit Midtown Castle 2845
## 3 3831 Cozy Entire Floor of Brownstone 4869
## 4 5022 Entire Apt: Spacious Studio/Loft by central park 7192
## 5 5099 Large Cozy 1 BR Apartment In Midtown East 7322
## 6 5121 BlissArtsSpace! 7356
## host_name neighbourhood_group neighbourhood latitude longitude
## 1 John Brooklyn Kensington 40.64749 -73.97237
## 2 Jennifer Manhattan Midtown 40.75362 -73.98377
## 3 LisaRoxanne Brooklyn Clinton Hill 40.68514 -73.95976
## 4 Laura Manhattan East Harlem 40.79851 -73.94399
## 5 Chris Manhattan Murray Hill 40.74767 -73.97500
## 6 Garon Brooklyn Bedford-Stuyvesant 40.68688 -73.95596
## room_type price minimum_nights number_of_reviews last_review
## 1 Private room 149 1 9 10/19/18
## 2 Entire home/apt 225 1 45 5/21/19
## 3 Entire home/apt 89 1 270 7/5/19
## 4 Entire home/apt 80 10 9 11/19/18
## 5 Entire home/apt 200 3 74 6/22/19
## 6 Private room 60 45 49 10/5/17
## reviews_per_month calculated_host_listings_count availability_365
## 1 0.21 6 365
## 2 0.38 2 355
## 3 4.64 1 194
## 4 0.10 1 0
## 5 0.59 1 129
## 6 0.40 1 0
nyc.anova.raw2 <- select(nyc.anova.raw, -c("id", "name", "host_id", "host_name", "last_review", "latitude", "longitude", "neighbourhood", "minimum_nights", "number_of_reviews", "last_review", "reviews_per_month", "calculated_host_listings_count", "availability_365"))
head(nyc.anova.raw2)
## neighbourhood_group room_type price
## 1 Brooklyn Private room 149
## 2 Manhattan Entire home/apt 225
## 3 Brooklyn Entire home/apt 89
## 4 Manhattan Entire home/apt 80
## 5 Manhattan Entire home/apt 200
## 6 Brooklyn Private room 60
nyc.anova.raw2 <- filter(nyc.anova.raw2, price >= 25 & price <= 400)
invisible(view(nyc.anova.raw2))
nyc.anova <- nyc.anova.raw2
#Attaching the data set
attach(nyc.anova)
#Creating a function
nycsummary<-function(x){
result<-c(length(x),mean(x),sd(x),sd(x)/sqrt(length(x)), min(x), max(x), IQR(x))
names(result)<-c("N","Mean","SD","SE","Min","Max","IQR")
return(result)
}
#Creating a summary stats table
nycsumstats<-aggregate(price~neighbourhood_group*room_type,data=nyc.anova,nycsummary)
nycsumstats<-cbind(nycsumstats[,1:2],nycsumstats[,-(1:2)])
nycsumstats
## neighbourhood_group room_type N Mean SD SE
## 1 Bronx Entire home/apt 298 114.47987 58.13523 3.3676835
## 2 Brooklyn Entire home/apt 7019 154.03733 67.74270 0.8085835
## 3 Manhattan Entire home/apt 7940 190.24181 74.32768 0.8341427
## 4 Queens Entire home/apt 1594 135.40088 65.71060 1.6458538
## 5 Staten Island Entire home/apt 145 118.80000 58.50411 4.8585017
## 6 Bronx Private room 504 57.58929 26.98118 1.2018373
## 7 Brooklyn Private room 7002 70.03870 32.59757 0.3895599
## 8 Manhattan Private room 5455 99.57984 51.39588 0.6958745
## 9 Queens Private room 2538 64.01418 29.55717 0.5867012
## 10 Staten Island Private room 156 58.12179 27.52672 2.2039018
## 11 Bronx Shared room 35 42.68571 25.20244 4.2599900
## 12 Brooklyn Shared room 252 44.62302 29.90884 1.8840797
## 13 Manhattan Shared room 317 71.03470 40.11323 2.2529837
## 14 Queens Shared room 132 43.03030 19.56393 1.7028211
## 15 Staten Island Shared room 3 85.00000 60.62178 35.0000000
## Min Max IQR
## 1 35 399 51.00
## 2 25 400 85.00
## 3 35 400 97.25
## 4 25 400 70.00
## 5 48 300 65.00
## 6 25 300 28.00
## 7 25 400 30.00
## 8 25 400 46.00
## 9 25 395 28.00
## 10 25 235 33.00
## 11 25 165 22.50
## 12 25 250 15.00
## 13 25 350 31.00
## 14 25 120 15.00
## 15 30 150 60.00
#- The below graph shows characteristics of a nonadditive model #- Next Steps: # 1. Fit a non-additive model # 2. Check the assumptions # 3. Exmine Type III Sum of Squares F-test tables
ggplot(nycsumstats,aes(x=room_type,y=Mean,group=neighbourhood_group,colour=neighbourhood_group))+
ylab("NYC AirBnBs Prices")+xlab("Room Type")+
geom_line()+
geom_point()+
geom_errorbar(aes(ymin=Mean-SD,ymax=Mean+SD),width=.1)
#The following code fits the nonadditive two way anova model and then produces the first the main residual diagnostics for assumption checking
nyc.model.fit<-aov(price~neighbourhood_group+room_type+neighbourhood_group:room_type,data=nyc.anova)
nyc.fits <- data.frame(fitted.values=nyc.model.fit$fitted.values,residuals=nyc.model.fit$residuals)
#Reisudals vs Fitted
nyc.plot1 <- ggplot(nyc.fits, aes(x=fitted.values,y=residuals))+ylab("Residuals")+
xlab("Predicted")+geom_point()
#QQ Plot of residuals #Note the diagonal abline is only good for qqplots of normal data
nyc.plot2 <- ggplot(nyc.fits,aes(sample=residuals))+
stat_qq()+geom_abline(intercept=mean(nyc.fits$residuals), slope = sd(nyc.fits$residuals))
#Histograms of residuals
nyc.plot3 <- ggplot(nyc.fits, aes(x=residuals)) +
geom_histogram(aes(y=..density..),binwidth=1,color="black", fill="gray")+
geom_density(alpha=.1, fill="red")
#Grid of all 3 graphs above
grid.arrange(nyc.plot1, nyc.plot2, nyc.plot3, ncol=3)
par(mfrow=c(2,2))
plot(nyc.model.fit)
#Transforming price to logged variable
nyc.log.anova <- nyc.anova %>% mutate(lprice=log(price))
#view(nyc.final)
nyc.model.fit.log<-aov(lprice~neighbourhood_group+room_type+neighbourhood_group:room_type,data=nyc.log.anova)
nyc.fits.log <- data.frame(fitted.values=nyc.model.fit.log$fitted.values,residuals=nyc.model.fit.log$residuals)
#Reisudals vs Fitted
nyc.logplot1 <- ggplot(nyc.fits.log, aes(x=fitted.values,y=residuals))+ylab("Residuals")+
xlab("Predicted")+geom_point()
#QQ Plot of residuals #Note the diagonal abline is only good for qqplots of normal data
nyc.logplot2 <- ggplot(nyc.fits.log,aes(sample=residuals))+
stat_qq()+geom_abline(intercept=mean(nyc.fits.log$residuals), slope = sd(nyc.fits.log$residuals))
#Histograms of residuals
nyc.logplot3 <- ggplot(nyc.fits.log, aes(x=residuals)) +
geom_histogram(aes(y=..density..),binwidth=1,color="black", fill="gray")+
geom_density(alpha=.1, fill="red")
#Grid of all 3 graphs above
grid.arrange(nyc.logplot1, nyc.logplot2, nyc.logplot3, ncol=3)
par(mfrow=c(2,2))
plot(nyc.model.fit.log)
Anova(nyc.model.fit, type = 3)
## Anova Table (Type III tests)
##
## Response: price
## Sum Sq Df F value
## (Intercept) 3905481 1 1187.124
## neighbourhood_group 8194094 4 622.677
## room_type 649678 2 98.739
## neighbourhood_group:room_type 529559 8 20.121
## Residuals 109799287 33375
## Pr(>F)
## (Intercept) < 0.00000000000000022 ***
## neighbourhood_group < 0.00000000000000022 ***
## room_type < 0.00000000000000022 ***
## neighbourhood_group:room_type < 0.00000000000000022 ***
## Residuals
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova(nyc.model.fit.log,type=3)
## Anova Table (Type III tests)
##
## Response: lprice
## Sum Sq Df F value Pr(>F)
## (Intercept) 6420.9 1 39324.029 < 0.00000000000000022
## neighbourhood_group 350.2 4 536.194 < 0.00000000000000022
## room_type 93.4 2 286.105 < 0.00000000000000022
## neighbourhood_group:room_type 27.4 8 20.988 < 0.00000000000000022
## Residuals 5449.6 33375
##
## (Intercept) ***
## neighbourhood_group ***
## room_type ***
## neighbourhood_group:room_type ***
## Residuals
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Confidence Intervals for F Test
confint(nyc.model.fit.log)
## 2.5 %
## (Intercept) 4.59597020
## neighbourhood_groupBrooklyn 0.26099010
## neighbourhood_groupManhattan 0.48444255
## neighbourhood_groupQueens 0.11454831
## neighbourhood_groupStaten Island -0.04476596
## room_typePrivate room -0.72145305
## room_typeShared room -1.13046074
## neighbourhood_groupBrooklyn:room_typePrivate room -0.17638784
## neighbourhood_groupManhattan:room_typePrivate room -0.06971507
## neighbourhood_groupQueens:room_typePrivate room -0.12053167
## neighbourhood_groupStaten Island:room_typePrivate room -0.14684224
## neighbourhood_groupBrooklyn:room_typeShared room -0.42930871
## neighbourhood_groupManhattan:room_typeShared room -0.17555003
## neighbourhood_groupQueens:room_typeShared room -0.28983872
## neighbourhood_groupStaten Island:room_typeShared room 0.07160305
## 97.5 %
## (Intercept) 4.687730749
## neighbourhood_groupBrooklyn 0.354678302
## neighbourhood_groupManhattan 0.577909184
## neighbourhood_groupQueens 0.214518934
## neighbourhood_groupStaten Island 0.115622772
## room_typePrivate room -0.605701211
## room_typeShared room -0.847423174
## neighbourhood_groupBrooklyn:room_typePrivate room -0.057584148
## neighbourhood_groupManhattan:room_typePrivate room 0.049341540
## neighbourhood_groupQueens:room_typePrivate room 0.005806175
## neighbourhood_groupStaten Island:room_typePrivate room 0.069461684
## neighbourhood_groupBrooklyn:room_typeShared room -0.128601673
## neighbourhood_groupManhattan:room_typeShared room 0.121673124
## neighbourhood_groupQueens:room_typeShared room 0.027483150
## neighbourhood_groupStaten Island:room_typeShared room 1.037936956
nyc.anova.diff <- TukeyHSD(nyc.model.fit,"neighbourhood_group:room_type", conf.level = .95)
nyc.anova.diff
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = price ~ neighbourhood_group + room_type + neighbourhood_group:room_type, data = nyc.anova)
##
## $`neighbourhood_group:room_type`
## diff
## Brooklyn:Entire home/apt-Bronx:Entire home/apt 39.5574615
## Manhattan:Entire home/apt-Bronx:Entire home/apt 75.7619478
## Queens:Entire home/apt-Bronx:Entire home/apt 20.9210125
## Staten Island:Entire home/apt-Bronx:Entire home/apt 4.3201342
## Bronx:Private room-Bronx:Entire home/apt -56.8905801
## Brooklyn:Private room-Bronx:Entire home/apt -44.4411625
## Manhattan:Private room-Bronx:Entire home/apt -14.9000308
## Queens:Private room-Bronx:Entire home/apt -50.4656814
## Staten Island:Private room-Bronx:Entire home/apt -56.3580709
## Bronx:Shared room-Bronx:Entire home/apt -71.7941515
## Brooklyn:Shared room-Bronx:Entire home/apt -69.8568499
## Manhattan:Shared room-Bronx:Entire home/apt -43.4451655
## Queens:Shared room-Bronx:Entire home/apt -71.4495627
## Staten Island:Shared room-Bronx:Entire home/apt -29.4798658
## Manhattan:Entire home/apt-Brooklyn:Entire home/apt 36.2044863
## Queens:Entire home/apt-Brooklyn:Entire home/apt -18.6364490
## Staten Island:Entire home/apt-Brooklyn:Entire home/apt -35.2373273
## Bronx:Private room-Brooklyn:Entire home/apt -96.4480415
## Brooklyn:Private room-Brooklyn:Entire home/apt -83.9986240
## Manhattan:Private room-Brooklyn:Entire home/apt -54.4574922
## Queens:Private room-Brooklyn:Entire home/apt -90.0231429
## Staten Island:Private room-Brooklyn:Entire home/apt -95.9155324
## Bronx:Shared room-Brooklyn:Entire home/apt -111.3516130
## Brooklyn:Shared room-Brooklyn:Entire home/apt -109.4143114
## Manhattan:Shared room-Brooklyn:Entire home/apt -83.0026269
## Queens:Shared room-Brooklyn:Entire home/apt -111.0070242
## Staten Island:Shared room-Brooklyn:Entire home/apt -69.0373273
## Queens:Entire home/apt-Manhattan:Entire home/apt -54.8409353
## Staten Island:Entire home/apt-Manhattan:Entire home/apt -71.4418136
## Bronx:Private room-Manhattan:Entire home/apt -132.6525279
## Brooklyn:Private room-Manhattan:Entire home/apt -120.2031104
## Manhattan:Private room-Manhattan:Entire home/apt -90.6619786
## Queens:Private room-Manhattan:Entire home/apt -126.2276292
## Staten Island:Private room-Manhattan:Entire home/apt -132.1200187
## Bronx:Shared room-Manhattan:Entire home/apt -147.5560993
## Brooklyn:Shared room-Manhattan:Entire home/apt -145.6187977
## Manhattan:Shared room-Manhattan:Entire home/apt -119.2071133
## Queens:Shared room-Manhattan:Entire home/apt -147.2115106
## Staten Island:Shared room-Manhattan:Entire home/apt -105.2418136
## Staten Island:Entire home/apt-Queens:Entire home/apt -16.6008783
## Bronx:Private room-Queens:Entire home/apt -77.8115926
## Brooklyn:Private room-Queens:Entire home/apt -65.3621751
## Manhattan:Private room-Queens:Entire home/apt -35.8210433
## Queens:Private room-Queens:Entire home/apt -71.3866939
## Staten Island:Private room-Queens:Entire home/apt -77.2790834
## Bronx:Shared room-Queens:Entire home/apt -92.7151640
## Brooklyn:Shared room-Queens:Entire home/apt -90.7778624
## Manhattan:Shared room-Queens:Entire home/apt -64.3661780
## Queens:Shared room-Queens:Entire home/apt -92.3705753
## Staten Island:Shared room-Queens:Entire home/apt -50.4008783
## Bronx:Private room-Staten Island:Entire home/apt -61.2107143
## Brooklyn:Private room-Staten Island:Entire home/apt -48.7612968
## Manhattan:Private room-Staten Island:Entire home/apt -19.2201650
## Queens:Private room-Staten Island:Entire home/apt -54.7858156
## Staten Island:Private room-Staten Island:Entire home/apt -60.6782051
## Bronx:Shared room-Staten Island:Entire home/apt -76.1142857
## Brooklyn:Shared room-Staten Island:Entire home/apt -74.1769841
## Manhattan:Shared room-Staten Island:Entire home/apt -47.7652997
## Queens:Shared room-Staten Island:Entire home/apt -75.7696970
## Staten Island:Shared room-Staten Island:Entire home/apt -33.8000000
## Brooklyn:Private room-Bronx:Private room 12.4494175
## Manhattan:Private room-Bronx:Private room 41.9905493
## Queens:Private room-Bronx:Private room 6.4248987
## Staten Island:Private room-Bronx:Private room 0.5325092
## Bronx:Shared room-Bronx:Private room -14.9035714
## Brooklyn:Shared room-Bronx:Private room -12.9662698
## Manhattan:Shared room-Bronx:Private room 13.4454146
## Queens:Shared room-Bronx:Private room -14.5589827
## Staten Island:Shared room-Bronx:Private room 27.4107143
## Manhattan:Private room-Brooklyn:Private room 29.5411318
## Queens:Private room-Brooklyn:Private room -6.0245188
## Staten Island:Private room-Brooklyn:Private room -11.9169084
## Bronx:Shared room-Brooklyn:Private room -27.3529889
## Brooklyn:Shared room-Brooklyn:Private room -25.4156874
## Manhattan:Shared room-Brooklyn:Private room 0.9959971
## Queens:Shared room-Brooklyn:Private room -27.0084002
## Staten Island:Shared room-Brooklyn:Private room 14.9612968
## Queens:Private room-Manhattan:Private room -35.5656506
## Staten Island:Private room-Manhattan:Private room -41.4580401
## Bronx:Shared room-Manhattan:Private room -56.8941207
## Brooklyn:Shared room-Manhattan:Private room -54.9568191
## Manhattan:Shared room-Manhattan:Private room -28.5451347
## Queens:Shared room-Manhattan:Private room -56.5495320
## Staten Island:Shared room-Manhattan:Private room -14.5798350
## Staten Island:Private room-Queens:Private room -5.8923895
## Bronx:Shared room-Queens:Private room -21.3284701
## Brooklyn:Shared room-Queens:Private room -19.3911685
## Manhattan:Shared room-Queens:Private room 7.0205159
## Queens:Shared room-Queens:Private room -20.9838814
## Staten Island:Shared room-Queens:Private room 20.9858156
## Bronx:Shared room-Staten Island:Private room -15.4360806
## Brooklyn:Shared room-Staten Island:Private room -13.4987790
## Manhattan:Shared room-Staten Island:Private room 12.9129054
## Queens:Shared room-Staten Island:Private room -15.0914918
## Staten Island:Shared room-Staten Island:Private room 26.8782051
## Brooklyn:Shared room-Bronx:Shared room 1.9373016
## Manhattan:Shared room-Bronx:Shared room 28.3489860
## Queens:Shared room-Bronx:Shared room 0.3445887
## Staten Island:Shared room-Bronx:Shared room 42.3142857
## Manhattan:Shared room-Brooklyn:Shared room 26.4116844
## Queens:Shared room-Brooklyn:Shared room -1.5927128
## Staten Island:Shared room-Brooklyn:Shared room 40.3769841
## Queens:Shared room-Manhattan:Shared room -28.0043973
## Staten Island:Shared room-Manhattan:Shared room 13.9652997
## Staten Island:Shared room-Queens:Shared room 41.9696970
## lwr
## Brooklyn:Entire home/apt-Bronx:Entire home/apt 28.0529766
## Manhattan:Entire home/apt-Bronx:Entire home/apt 64.2846694
## Queens:Entire home/apt-Bronx:Entire home/apt 8.6450747
## Staten Island:Entire home/apt-Bronx:Entire home/apt -15.3748726
## Bronx:Private room-Bronx:Entire home/apt -71.1043797
## Brooklyn:Private room-Bronx:Entire home/apt -55.9462162
## Manhattan:Private room-Bronx:Entire home/apt -26.4714887
## Queens:Private room-Bronx:Entire home/apt -62.3766088
## Staten Island:Private room-Bronx:Entire home/apt -75.5803067
## Bronx:Shared room-Bronx:Entire home/apt -106.5498777
## Brooklyn:Shared room-Bronx:Entire home/apt -86.5032124
## Manhattan:Shared room-Bronx:Entire home/apt -59.1396190
## Queens:Shared room-Bronx:Entire home/apt -91.7864994
## Staten Island:Shared room-Bronx:Entire home/apt -142.3452835
## Manhattan:Entire home/apt-Brooklyn:Entire home/apt 33.0177230
## Queens:Entire home/apt-Brooklyn:Entire home/apt -24.0333176
## Staten Island:Entire home/apt-Brooklyn:Entire home/apt -51.5566665
## Bronx:Private room-Brooklyn:Entire home/apt -105.4179714
## Brooklyn:Private room-Brooklyn:Entire home/apt -87.2840163
## Manhattan:Private room-Brooklyn:Entire home/apt -57.9683584
## Queens:Private room-Brooklyn:Entire home/apt -94.5284434
## Staten Island:Private room-Brooklyn:Entire home/apt -111.6610680
## Bronx:Shared room-Brooklyn:Entire home/apt -144.3120142
## Brooklyn:Shared room-Brooklyn:Entire home/apt -121.8854350
## Manhattan:Shared room-Brooklyn:Entire home/apt -94.1714861
## Queens:Shared room-Brooklyn:Entire home/apt -128.0955740
## Staten Island:Shared room-Brooklyn:Entire home/apt -181.3628812
## Queens:Entire home/apt-Manhattan:Entire home/apt -60.1795622
## Staten Island:Entire home/apt-Manhattan:Entire home/apt -87.7419848
## Bronx:Private room-Manhattan:Entire home/apt -141.5875370
## Brooklyn:Private room-Manhattan:Entire home/apt -123.3919264
## Manhattan:Private room-Manhattan:Entire home/apt -94.0826404
## Queens:Private room-Manhattan:Entire home/apt -130.6629960
## Staten Island:Private room-Manhattan:Entire home/apt -147.8456868
## Bronx:Shared room-Manhattan:Entire home/apt -180.5070142
## Brooklyn:Shared room-Manhattan:Entire home/apt -158.0648281
## Manhattan:Shared room-Manhattan:Entire home/apt -130.3479463
## Queens:Shared room-Manhattan:Entire home/apt -164.2817560
## Staten Island:Shared room-Manhattan:Entire home/apt -217.5645843
## Staten Island:Entire home/apt-Queens:Entire home/apt -33.4729354
## Bronx:Private room-Queens:Entire home/apt -87.7516689
## Brooklyn:Private room-Queens:Entire home/apt -70.7602561
## Manhattan:Private room-Queens:Entire home/apt -41.3592431
## Queens:Private room-Queens:Entire home/apt -77.6030601
## Staten Island:Private room-Queens:Entire home/apt -93.5967844
## Bronx:Shared room-Queens:Entire home/apt -125.9526959
## Brooklyn:Shared room-Queens:Entire home/apt -103.9640067
## Manhattan:Shared room-Queens:Entire home/apt -76.3281549
## Queens:Shared room-Queens:Entire home/apt -109.9877263
## Staten Island:Shared room-Queens:Entire home/apt -162.8080647
## Bronx:Private room-Staten Island:Entire home/apt -79.5410105
## Brooklyn:Private room-Staten Island:Entire home/apt -65.0810370
## Manhattan:Private room-Staten Island:Entire home/apt -35.5867865
## Queens:Private room-Staten Island:Entire home/apt -71.3941825
## Staten Island:Private room-Staten Island:Entire home/apt -83.1161643
## Bronx:Shared room-Staten Island:Entire home/apt -112.7466234
## Brooklyn:Shared room-Staten Island:Entire home/apt -94.4518219
## Manhattan:Shared room-Staten Island:Entire home/apt -67.2661595
## Queens:Shared room-Staten Island:Entire home/apt -99.1696682
## Staten Island:Shared room-Staten Island:Entire home/apt -147.2573497
## Brooklyn:Private room-Bronx:Private room 3.4787582
## Manhattan:Private room-Bronx:Private room 32.9348821
## Queens:Private room-Bronx:Private room -3.0607041
## Staten Island:Private room-Bronx:Private room -17.2888493
## Bronx:Shared room-Bronx:Private room -48.9045563
## Brooklyn:Shared room-Bronx:Private room -27.9731966
## Manhattan:Shared room-Bronx:Private room -0.4981266
## Queens:Shared room-Bronx:Private room -33.5773280
## Staten Island:Shared room-Bronx:Private room -85.2245777
## Manhattan:Private room-Brooklyn:Private room 26.0284023
## Queens:Private room-Brooklyn:Private room -10.5312716
## Staten Island:Private room-Brooklyn:Private room -27.6628595
## Bronx:Shared room-Brooklyn:Private room -60.3135887
## Brooklyn:Shared room-Brooklyn:Private room -37.8873357
## Manhattan:Shared room-Brooklyn:Private room -10.1734479
## Queens:Shared room-Brooklyn:Private room -44.0973329
## Staten Island:Shared room-Brooklyn:Private room -97.3643154
## Queens:Private room-Manhattan:Private room -40.2393215
## Staten Island:Private room-Manhattan:Private room -57.2525758
## Bronx:Shared room-Manhattan:Private room -89.8779579
## Brooklyn:Shared room-Manhattan:Private room -67.4897514
## Manhattan:Shared room-Manhattan:Private room -39.7829673
## Queens:Shared room-Manhattan:Private room -73.6832414
## Staten Island:Shared room-Manhattan:Private room -126.9122682
## Staten Island:Private room-Queens:Private room -21.9372924
## Bronx:Shared room-Queens:Private room -54.4329270
## Brooklyn:Shared room-Queens:Private room -32.2381893
## Manhattan:Shared room-Queens:Private room -4.5665645
## Queens:Shared room-Queens:Private room -38.3486604
## Staten Island:Shared room-Queens:Private room -91.3820939
## Bronx:Shared room-Staten Island:Private room -51.8164217
## Brooklyn:Shared room-Staten Island:Private room -33.3146843
## Manhattan:Shared room-Staten Island:Private room -6.1103590
## Queens:Shared room-Staten Island:Private room -38.0949635
## Staten Island:Shared room-Staten Island:Private room -86.4980324
## Brooklyn:Shared room-Bronx:Shared room -33.1502497
## Manhattan:Shared room-Bronx:Shared room -6.2970923
## Queens:Shared room-Bronx:Shared room -36.6368372
## Staten Island:Shared room-Bronx:Shared room -74.7012577
## Manhattan:Shared room-Brooklyn:Shared room 9.9954844
## Queens:Shared room-Brooklyn:Shared room -22.4916780
## Staten Island:Shared room-Brooklyn:Shared room -72.5910568
## Queens:Shared room-Manhattan:Shared room -48.1533733
## Staten Island:Shared room-Manhattan:Shared room -98.8664014
## Staten Island:Shared room-Queens:Shared room -71.6008445
## upr
## Brooklyn:Entire home/apt-Bronx:Entire home/apt 51.0619464
## Manhattan:Entire home/apt-Bronx:Entire home/apt 87.2392262
## Queens:Entire home/apt-Bronx:Entire home/apt 33.1969504
## Staten Island:Entire home/apt-Bronx:Entire home/apt 24.0151410
## Bronx:Private room-Bronx:Entire home/apt -42.6767804
## Brooklyn:Private room-Bronx:Entire home/apt -32.9361088
## Manhattan:Private room-Bronx:Entire home/apt -3.3285728
## Queens:Private room-Bronx:Entire home/apt -38.5547540
## Staten Island:Private room-Bronx:Entire home/apt -37.1358351
## Bronx:Shared room-Bronx:Entire home/apt -37.0384253
## Brooklyn:Shared room-Bronx:Entire home/apt -53.2104874
## Manhattan:Shared room-Bronx:Entire home/apt -27.7507119
## Queens:Shared room-Bronx:Entire home/apt -51.1126261
## Staten Island:Shared room-Bronx:Entire home/apt 83.3855520
## Manhattan:Entire home/apt-Brooklyn:Entire home/apt 39.3912497
## Queens:Entire home/apt-Brooklyn:Entire home/apt -13.2395803
## Staten Island:Entire home/apt-Brooklyn:Entire home/apt -18.9179880
## Bronx:Private room-Brooklyn:Entire home/apt -87.4781117
## Brooklyn:Private room-Brooklyn:Entire home/apt -80.7132318
## Manhattan:Private room-Brooklyn:Entire home/apt -50.9466261
## Queens:Private room-Brooklyn:Entire home/apt -85.5178423
## Staten Island:Private room-Brooklyn:Entire home/apt -80.1699968
## Bronx:Shared room-Brooklyn:Entire home/apt -78.3912118
## Brooklyn:Shared room-Brooklyn:Entire home/apt -96.9431877
## Manhattan:Shared room-Brooklyn:Entire home/apt -71.8337678
## Queens:Shared room-Brooklyn:Entire home/apt -93.9184745
## Staten Island:Shared room-Brooklyn:Entire home/apt 43.2882267
## Queens:Entire home/apt-Manhattan:Entire home/apt -49.5023084
## Staten Island:Entire home/apt-Manhattan:Entire home/apt -55.1416424
## Bronx:Private room-Manhattan:Entire home/apt -123.7175188
## Brooklyn:Private room-Manhattan:Entire home/apt -117.0142943
## Manhattan:Private room-Manhattan:Entire home/apt -87.2413168
## Queens:Private room-Manhattan:Entire home/apt -121.7922624
## Staten Island:Private room-Manhattan:Entire home/apt -116.3943507
## Bronx:Shared room-Manhattan:Entire home/apt -114.6051844
## Brooklyn:Shared room-Manhattan:Entire home/apt -133.1727674
## Manhattan:Shared room-Manhattan:Entire home/apt -108.0662803
## Queens:Shared room-Manhattan:Entire home/apt -130.1412652
## Staten Island:Shared room-Manhattan:Entire home/apt 7.0809571
## Staten Island:Entire home/apt-Queens:Entire home/apt 0.2711788
## Bronx:Private room-Queens:Entire home/apt -67.8715162
## Brooklyn:Private room-Queens:Entire home/apt -59.9640941
## Manhattan:Private room-Queens:Entire home/apt -30.2828434
## Queens:Private room-Queens:Entire home/apt -65.1703276
## Staten Island:Private room-Queens:Entire home/apt -60.9613824
## Bronx:Shared room-Queens:Entire home/apt -59.4776322
## Brooklyn:Shared room-Queens:Entire home/apt -77.5917181
## Manhattan:Shared room-Queens:Entire home/apt -52.4042011
## Queens:Shared room-Queens:Entire home/apt -74.7534243
## Staten Island:Shared room-Queens:Entire home/apt 62.0063081
## Bronx:Private room-Staten Island:Entire home/apt -42.8804180
## Brooklyn:Private room-Staten Island:Entire home/apt -32.4415565
## Manhattan:Private room-Staten Island:Entire home/apt -2.8535434
## Queens:Private room-Staten Island:Entire home/apt -38.1774487
## Staten Island:Private room-Staten Island:Entire home/apt -38.2402460
## Bronx:Shared room-Staten Island:Entire home/apt -39.4819480
## Brooklyn:Shared room-Staten Island:Entire home/apt -53.9021464
## Manhattan:Shared room-Staten Island:Entire home/apt -28.2644399
## Queens:Shared room-Staten Island:Entire home/apt -52.3697258
## Staten Island:Shared room-Staten Island:Entire home/apt 79.6573497
## Brooklyn:Private room-Bronx:Private room 21.4200768
## Manhattan:Private room-Bronx:Private room 51.0462165
## Queens:Private room-Bronx:Private room 15.9105014
## Staten Island:Private room-Bronx:Private room 18.3538676
## Bronx:Shared room-Bronx:Private room 19.0974135
## Brooklyn:Shared room-Bronx:Private room 2.0406570
## Manhattan:Shared room-Bronx:Private room 27.3889558
## Queens:Shared room-Bronx:Private room 4.4593627
## Staten Island:Shared room-Bronx:Private room 140.0460063
## Manhattan:Private room-Brooklyn:Private room 33.0538613
## Queens:Private room-Brooklyn:Private room -1.5177661
## Staten Island:Private room-Brooklyn:Private room 3.8290428
## Bronx:Shared room-Brooklyn:Private room 5.6076108
## Brooklyn:Shared room-Brooklyn:Private room -12.9440390
## Manhattan:Shared room-Brooklyn:Private room 12.1654421
## Queens:Shared room-Brooklyn:Private room -9.9194675
## Staten Island:Shared room-Brooklyn:Private room 127.2869090
## Queens:Private room-Manhattan:Private room -30.8919797
## Staten Island:Private room-Manhattan:Private room -25.6635045
## Bronx:Shared room-Manhattan:Private room -23.9102836
## Brooklyn:Shared room-Manhattan:Private room -42.4238868
## Manhattan:Shared room-Manhattan:Private room -17.3073021
## Queens:Shared room-Manhattan:Private room -39.4158225
## Staten Island:Shared room-Manhattan:Private room 97.7525981
## Staten Island:Private room-Queens:Private room 10.1525134
## Bronx:Shared room-Queens:Private room 11.7759868
## Brooklyn:Shared room-Queens:Private room -6.5441477
## Manhattan:Shared room-Queens:Private room 18.6075963
## Queens:Shared room-Queens:Private room -3.6191023
## Staten Island:Shared room-Queens:Private room 133.3537251
## Bronx:Shared room-Staten Island:Private room 20.9442606
## Brooklyn:Shared room-Staten Island:Private room 6.3171263
## Manhattan:Shared room-Staten Island:Private room 31.9361699
## Queens:Shared room-Staten Island:Private room 7.9119798
## Staten Island:Shared room-Staten Island:Private room 140.2544427
## Brooklyn:Shared room-Bronx:Shared room 37.0248529
## Manhattan:Shared room-Bronx:Shared room 62.9950644
## Queens:Shared room-Bronx:Shared room 37.3260147
## Staten Island:Shared room-Bronx:Shared room 159.3298291
## Manhattan:Shared room-Brooklyn:Shared room 42.8278845
## Queens:Shared room-Brooklyn:Shared room 19.3062523
## Staten Island:Shared room-Brooklyn:Shared room 153.3450251
## Queens:Shared room-Manhattan:Shared room -7.8554213
## Staten Island:Shared room-Manhattan:Shared room 126.7970008
## Staten Island:Shared room-Queens:Shared room 155.5402384
## p adj
## Brooklyn:Entire home/apt-Bronx:Entire home/apt 0.0000000
## Manhattan:Entire home/apt-Bronx:Entire home/apt 0.0000000
## Queens:Entire home/apt-Bronx:Entire home/apt 0.0000008
## Staten Island:Entire home/apt-Bronx:Entire home/apt 0.9999901
## Bronx:Private room-Bronx:Entire home/apt 0.0000000
## Brooklyn:Private room-Bronx:Entire home/apt 0.0000000
## Manhattan:Private room-Bronx:Entire home/apt 0.0012031
## Queens:Private room-Bronx:Entire home/apt 0.0000000
## Staten Island:Private room-Bronx:Entire home/apt 0.0000000
## Bronx:Shared room-Bronx:Entire home/apt 0.0000000
## Brooklyn:Shared room-Bronx:Entire home/apt 0.0000000
## Manhattan:Shared room-Bronx:Entire home/apt 0.0000000
## Queens:Shared room-Bronx:Entire home/apt 0.0000000
## Staten Island:Shared room-Bronx:Entire home/apt 0.9999147
## Manhattan:Entire home/apt-Brooklyn:Entire home/apt 0.0000000
## Queens:Entire home/apt-Brooklyn:Entire home/apt 0.0000000
## Staten Island:Entire home/apt-Brooklyn:Entire home/apt 0.0000000
## Bronx:Private room-Brooklyn:Entire home/apt 0.0000000
## Brooklyn:Private room-Brooklyn:Entire home/apt 0.0000000
## Manhattan:Private room-Brooklyn:Entire home/apt 0.0000000
## Queens:Private room-Brooklyn:Entire home/apt 0.0000000
## Staten Island:Private room-Brooklyn:Entire home/apt 0.0000000
## Bronx:Shared room-Brooklyn:Entire home/apt 0.0000000
## Brooklyn:Shared room-Brooklyn:Entire home/apt 0.0000000
## Manhattan:Shared room-Brooklyn:Entire home/apt 0.0000000
## Queens:Shared room-Brooklyn:Entire home/apt 0.0000000
## Staten Island:Shared room-Brooklyn:Entire home/apt 0.7457561
## Queens:Entire home/apt-Manhattan:Entire home/apt 0.0000000
## Staten Island:Entire home/apt-Manhattan:Entire home/apt 0.0000000
## Bronx:Private room-Manhattan:Entire home/apt 0.0000000
## Brooklyn:Private room-Manhattan:Entire home/apt 0.0000000
## Manhattan:Private room-Manhattan:Entire home/apt 0.0000000
## Queens:Private room-Manhattan:Entire home/apt 0.0000000
## Staten Island:Private room-Manhattan:Entire home/apt 0.0000000
## Bronx:Shared room-Manhattan:Entire home/apt 0.0000000
## Brooklyn:Shared room-Manhattan:Entire home/apt 0.0000000
## Manhattan:Shared room-Manhattan:Entire home/apt 0.0000000
## Queens:Shared room-Manhattan:Entire home/apt 0.0000000
## Staten Island:Shared room-Manhattan:Entire home/apt 0.0949816
## Staten Island:Entire home/apt-Queens:Entire home/apt 0.0592759
## Bronx:Private room-Queens:Entire home/apt 0.0000000
## Brooklyn:Private room-Queens:Entire home/apt 0.0000000
## Manhattan:Private room-Queens:Entire home/apt 0.0000000
## Queens:Private room-Queens:Entire home/apt 0.0000000
## Staten Island:Private room-Queens:Entire home/apt 0.0000000
## Bronx:Shared room-Queens:Entire home/apt 0.0000000
## Brooklyn:Shared room-Queens:Entire home/apt 0.0000000
## Manhattan:Shared room-Queens:Entire home/apt 0.0000000
## Queens:Shared room-Queens:Entire home/apt 0.0000000
## Staten Island:Shared room-Queens:Entire home/apt 0.9734952
## Bronx:Private room-Staten Island:Entire home/apt 0.0000000
## Brooklyn:Private room-Staten Island:Entire home/apt 0.0000000
## Manhattan:Private room-Staten Island:Entire home/apt 0.0060403
## Queens:Private room-Staten Island:Entire home/apt 0.0000000
## Staten Island:Private room-Staten Island:Entire home/apt 0.0000000
## Bronx:Shared room-Staten Island:Entire home/apt 0.0000000
## Brooklyn:Shared room-Staten Island:Entire home/apt 0.0000000
## Manhattan:Shared room-Staten Island:Entire home/apt 0.0000000
## Queens:Shared room-Staten Island:Entire home/apt 0.0000000
## Staten Island:Shared room-Staten Island:Entire home/apt 0.9995992
## Brooklyn:Private room-Bronx:Private room 0.0002505
## Manhattan:Private room-Bronx:Private room 0.0000000
## Queens:Private room-Bronx:Private room 0.5927958
## Staten Island:Private room-Bronx:Private room 1.0000000
## Bronx:Shared room-Bronx:Private room 0.9783119
## Brooklyn:Shared room-Bronx:Private room 0.1823186
## Manhattan:Shared room-Bronx:Private room 0.0725456
## Queens:Shared room-Bronx:Private room 0.3722557
## Staten Island:Shared room-Bronx:Private room 0.9999639
## Manhattan:Private room-Brooklyn:Private room 0.0000000
## Queens:Private room-Brooklyn:Private room 0.0005663
## Staten Island:Private room-Brooklyn:Private room 0.3926501
## Bronx:Shared room-Brooklyn:Private room 0.2388147
## Brooklyn:Shared room-Brooklyn:Private room 0.0000000
## Manhattan:Shared room-Brooklyn:Private room 1.0000000
## Queens:Shared room-Brooklyn:Private room 0.0000086
## Staten Island:Shared room-Brooklyn:Private room 1.0000000
## Queens:Private room-Manhattan:Private room 0.0000000
## Staten Island:Private room-Manhattan:Private room 0.0000000
## Bronx:Shared room-Manhattan:Private room 0.0000005
## Brooklyn:Shared room-Manhattan:Private room 0.0000000
## Manhattan:Shared room-Manhattan:Private room 0.0000000
## Queens:Shared room-Manhattan:Private room 0.0000000
## Staten Island:Shared room-Manhattan:Private room 1.0000000
## Staten Island:Private room-Queens:Private room 0.9960658
## Bronx:Shared room-Queens:Private room 0.6759396
## Brooklyn:Shared room-Queens:Private room 0.0000314
## Manhattan:Shared room-Queens:Private room 0.7650326
## Queens:Shared room-Queens:Private room 0.0037890
## Staten Island:Shared room-Queens:Private room 0.9999987
## Bronx:Shared room-Staten Island:Private room 0.9838607
## Brooklyn:Shared room-Staten Island:Private room 0.5828455
## Manhattan:Shared room-Staten Island:Private room 0.5890421
## Queens:Shared room-Staten Island:Private room 0.6467812
## Staten Island:Shared room-Staten Island:Private room 0.9999738
## Brooklyn:Shared room-Bronx:Shared room 1.0000000
## Manhattan:Shared room-Bronx:Shared room 0.2603998
## Queens:Shared room-Bronx:Shared room 1.0000000
## Staten Island:Shared room-Bronx:Shared room 0.9966469
## Manhattan:Shared room-Brooklyn:Shared room 0.0000050
## Queens:Shared room-Brooklyn:Shared room 1.0000000
## Staten Island:Shared room-Brooklyn:Shared room 0.9970310
## Queens:Shared room-Manhattan:Shared room 0.0002421
## Staten Island:Shared room-Manhattan:Shared room 1.0000000
## Staten Island:Shared room-Queens:Shared room 0.9958048
plot(TukeyHSD(nyc.model.fit,"neighbourhood_group:room_type", conf.level = .95))
nyc.anova.diff2 = tidy(nyc.anova.diff)
colnames(nyc.anova.diff2)[3] <- "diff"
invisible(view(nyc.anova.diff2))
nyc.anova.diffdf <- nyc.anova.diff2[nyc.anova.diff2$adj.p.value <0.05,]
nyc.anova.diffdf <- nyc.anova.diffdf[order(nyc.anova.diffdf$diff),]
nyc.anova.diffdf
## # A tibble: 69 x 6
## term comparison diff conf.low conf.high adj.p.value
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 neighbourho… Bronx:Shared room-Man… -148. -181. -115. 0
## 2 neighbourho… Queens:Shared room-Ma… -147. -164. -130. 0
## 3 neighbourho… Brooklyn:Shared room-… -146. -158. -133. 0
## 4 neighbourho… Bronx:Private room-Ma… -133. -142. -124. 0
## 5 neighbourho… Staten Island:Private… -132. -148. -116. 0
## 6 neighbourho… Queens:Private room-M… -126. -131. -122. 0
## 7 neighbourho… Brooklyn:Private room… -120. -123. -117. 0
## 8 neighbourho… Manhattan:Shared room… -119. -130. -108. 0
## 9 neighbourho… Bronx:Shared room-Bro… -111. -144. -78.4 0
## 10 neighbourho… Queens:Shared room-Br… -111. -128. -93.9 0
## # … with 59 more rows
#nyc.anova.log.diff <- TukeyHSD(nyc.model.fit.log,"neighbourhood_group:room_type", conf.level = .95)
#nyc.anova.log.diff
#plot(TukeyHSD(nyc.model.fit.log,"neighbourhood_group:room_type", conf.level = .95))
#nyc.anova.log.diff2 = tidy(nyc.anova.log.diff)
#colnames(nyc.anova.log.diff2)[3] <- "diff"
#invisible(view(nyc.anova.log.diff2))
#nyc.anova.log.diffdf <- nyc.anova.log.diff2[nyc.anova.log.diff2$adj.p.value <0.05,]
#invisible(yc.anova.log.diffdf)
#ConfInt_Diff_Backlog <- yc.anova.log.diffdf %>% mutate(Tdiff = exp(diff))
#ConfInt_Diff_Backlog <- ConfInt_Diff_Backlog %>% mutate(Tlow = exp(conf.low))
#ConfInt_Diff_Backlog <- ConfInt_Diff_Backlog %>% mutate(Thigh = exp(conf.high))
#ConfInt_Diff_Backlog <- select(ConfInt_Diff_Backlog, -c("diff", "conf.low", "conf.high"))
#ConfInt_Diff_Backlog <- ConfInt_Diff_Backlog[order(-ConfInt_Diff_Backlog$Tdiff),]
#ConfInt_Diff_Backlog